<?php
/*
 * mk script created on 12-oct-2005
 * jaco_at_pixeldump_dot_org
 * prepping assets
 */

include("sample_utils.php");                               // provides some utils and using mk

$swfFN = "test_asset.swf";                                 // file to generate

$shape1 = new MKShapeContainer();                         // the shape
$shape1->add_fillStyle_solid("#FF0000");                   // add a new fill color
$shape1->add_rect(-50, -50, 100, 100);                     // draw a rectangle
$shape1->add_fillStyle_solid("#660000");                   // add a new fill color
$shape1->add_circle(30, 0, 0);                             // draw a circle
$shapeTD1 = $shape1->update_tagData();                     // get binary tag data
$shapePB1 = $shape1->update_place_tagData();

$mc = new MKmovieclip("", 2);                              // create new movieclip
$mc->set_linkage_name("mc");                               // assign a linkage name
$mc->add_tagData($shapePB1, 1);                            // populate mc with placing settings
$mcTD  = $mc->update_tagData();                            // get binary tag data from mc
$mcAssetTD = $mc->update_linkage_tagData();

$swf = new MKSwf($swfFN);                                  // start a fresh swf
$swf->set_swfDir(SERVER_MKTMP);                            // change default working dir
$swf->set_swfVersion(7);                                   // set version (flash mx 2004)
$swf->set_fps(24);                                         // set frames per second

$swf->add_tagData($shapeTD1);                              // populate with shape
$swf->add_tagData($mcTD);                                  // populate with mc
$swf->add_tagData($mcAssetTD);                             // populate with linkage

$swf->swf_output();                                        // save to disk

$swfHeader = $swf->fetch_assoc();

$str = "<div style=\"background-color:#CCCCCC; width:700px; height:500px; padding:10px; text-align:center\">";
$str .= render_swf_box($swfHeader, $imgDir, false);
$str .= "<br/><strong>" .$swfFN ." created in :<br />";
$str .= SERVER_MKTMP ."</strong><p>don't worry if it looks empty :P</div>";
echo show_content($str, basename(__FILE__));
?>
